package com.medata.service.impl;

import com.medata.dataObject.LockIp;
import com.medata.repository.LockipRepository;
import com.medata.service.LockipService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;

/**
 * @author ：zb
 * @date ：Created in 2019/6/10 0010 15:34
 * @description：
 */
@Service
public class LockipServiceImpl implements LockipService {
    @Autowired
    private LockipRepository repository;
    @Override
    public LockIp findByIpid(Integer id) {
        return repository.findByIpid(id);
    }

    @Override
    @Transactional
    public void deleteByIpid(Integer id) {
        repository.deleteByIpid(id);
    }

    @Override
    public Page<LockIp> findall(Pageable pageable) {
        return repository.findAll(pageable);
    }

    @Override
    @Transactional
    public void deleteByAreaid(Integer id) {
        repository.deleteAllByAreaid(id);
    }

    @Override
    public void saveOrUpdate(LockIp lockIp) {
        repository.save(lockIp);
    }
}
